﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using LINQtoNHibernateMVC.Core.Domain;
using LINQtoNHibernateMVC.Core.Domain.Model;

namespace LINQtoNHibernateMVC.Web.Controllers {
	[HandleError]
	public class HomeController : Controller {
		private readonly IRepository _repository;

		public HomeController(IRepository repository) {
			_repository = repository;
		}

		public ActionResult Index() {
			ViewData["Message"] = "Welcome to ASP.NET MVC!";
			
			var person = new Person() {Name = "Tim"};
			_repository.Add(person);
			_repository.SubmitChanges();
			
			return View();
		}

		public ActionResult About() {
			return View();
		}
	}
}
